<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%order_comment}}".
 *
 * @property int $id
 * @property int|null $userid 用户id
 * @property int|null $good_id 商品id
 * @property int|null $order_id 订单id
 * @property int|null $order_good_id 订单商品id
 * @property string|null $logistics_star 物流星
 * @property string|null $service_attitude 服务态度
 * @property string|null $content 内容
 * @property int|null $status 状态
 * @property string|null $review_time 审核时间
 * @property string|null $review_remark 审核备注
 * @property string|null $create_time
 * @property string|null $update_time
 * @property string|null $info 信息
 * @property string|null $imgs 图片
 * @property int|null $review_status 审核状态
 */
class OrderComment extends BaseModel
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%order_comment}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['userid', 'good_id', 'order_id', 'order_good_id', 'status', 'review_status'], 'integer'],
            [['content', 'review_remark', 'info', 'imgs'], 'string'],
            [['review_time', 'create_time', 'update_time'], 'safe'],
            [['logistics_star', 'service_attitude'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'userid' => '用户id',
            'good_id' => '商品id',
            'order_id' => '订单id',
            'order_good_id' => '订单商品id',
            'logistics_star' => '物流星',
            'service_attitude' => '服务态度',
            'content' => '内容',
            'status' => '状态',
            'review_time' => '审核时间',
            'review_remark' => '审核备注',
            'create_time' => 'Create Time',
            'update_time' => 'Update Time',
            'info' => '信息',
            'imgs' => '图片',
            'review_status' => '审核状态',
        ];
    }

    public function getGoods()
    {
        return $this->hasOne(Goods::className(),['id'=>'good_id']);
    }

    public function getOrder()
    {
        return $this->hasOne(Order::className(),['id'=>'order_id']);
    }
}
